<template>
  <a-layout class="ym-dashboard-layout">
    <a-layout-sider
      :trigger="null"
      collapsible
      v-model="collapsed"
    >
      <div class="logo">YM</div>
      <a-menu theme="dark" mode="inline" :defaultSelectedKeys="['1']">
        <a-menu-item key="1">
          <a-icon type="user" />
          <span>nav 1</span>
        </a-menu-item>
        <a-menu-item key="2">
          <a-icon type="video-camera" />
          <span>nav 2</span>
        </a-menu-item>
        <a-menu-item key="3">
          <a-icon type="upload" />
          <span>nav 3</span>
        </a-menu-item>
      </a-menu>
    </a-layout-sider>
    <a-layout>
      <a-layout-header>
        <a-icon
          class="trigger"
          :type="collapsed ? 'menu-unfold' : 'menu-fold'"
          @click="()=> collapsed = !collapsed"
        />
        <div class="right-side">
          <a-dropdown overlayClassName="ym-dashboard-layout__member-menu">
            <a class="ant-dropdown-link" href="#">
              <a-avatar size="large" icon="user"/>
            </a>
            <a-menu slot="overlay">
              <a-menu-item v-if="logged">
                <a href="javascript:;">个人资料</a>
              </a-menu-item>
              <a-menu-item v-if="logged">
                <a href="javascript:;">退出</a>
              </a-menu-item>
              <a-menu-item v-if="!logged">
                <a href="javascript:;">登录</a>
              </a-menu-item>
            </a-menu>
          </a-dropdown>
        </div>
      </a-layout-header>
      <a-layout-content>
        <router-view></router-view>
      </a-layout-content>
    </a-layout>
  </a-layout>
</template>

<script>
export default {
  props: {},
  data () {
    return {
      collapsed: false
    }
  },
  computed: {
  },
  created () {
  },
  mounted () {
  },
  methods: {
  },
  watch: {
  },
  components: {
  }
}
</script>

<style>
.ym-dashboard-layout {
  min-height: 100vh;
  .ant-layout-sider-children {
    .ant-menu {
      .ant-menu-item {
        &:first-child {
          margin-top: 0;
        }
      }
    }
  }
  & > .ant-layout {
    .ant-layout-header {
      padding: 0;
      color: #fff;
      background-color: #FFF;
      color: #001529;
    }
    .ant-layout-content {
      margin: 10px;
      padding: 10px;
      background-color: #FFF;
      min-height: 280px;
    }
    .right-side {
      display: inline-block;
      float: right;
      padding-right: 20px;
    }
  }
  .logo {
    height: 32px;
    line-height: 32px;
    text-align: center;
    background: rgba(255,255,255,.2);
    margin: 16px;
    color: #FFF;
  }
  .trigger:hover {
    color: #1890ff;
  }
  .trigger {
    font-size: 18px;
    line-height: 64px;
    padding: 0 24px;
    cursor: pointer;
    transition: color .3s;
  }
}
.ym-dashboard-layout__member-menu {
  .ant-dropdown-menu-item {
    min-width: 80px;
    text-align: center;
  }
}
</style>
